package com.yan.demo;

import java.util.Scanner;

public class Demo2 {
    public static void main1(String[] args) {
        // 字符串转基本数据类型
        int num = Integer.parseInt("123");
        System.out.println(num);
        double num1 = Double.parseDouble("3.14");
        System.out.println("num1 = " + num1);
        Boolean str = Boolean.parseBoolean("true");
        System.out.println("str = " + str);
        // 基本类型转字符串
        String str1 = Integer.toString(123);
        System.out.println("str1 = " + str1);
        String str2 = Double.toString(3.14);
        System.out.println("str2 = " + str2);
    }

    public static void main(String[] args) {
        System.out.println("请输入一个数");
        Scanner scanner = new Scanner(System.in);
        String age = scanner.next();
        Integer age1 = Integer.parseInt(age);
        age1 = age1 + 1;
        String age2 = Integer.toString(age1);
        System.out.println("age2 = " + age2);
    }
}
